package chapter7;

import java.util.*;

public class StorageTest {

    public Vector<Comparable> vectors = new Vector<>();
    public LinkedList<Comparable> lists = new LinkedList<>();
    public ArrayList<Comparable> arrays = new ArrayList<>();
    public HashMap<Comparable, Comparable> hmaps = new HashMap<>();
    public HashSet<Comparable> hsets = new HashSet<>();
    public TreeMap<Comparable, Comparable> treemaps= new TreeMap<>();

    public StorageTest(Comparable[] a) {


        for (int i = 0; i < a.length; i++) {
            vectors.add(a[i]);
            lists.add(a[i]);
            arrays.add(a[i]);
            hsets.add(a[i]);
            hmaps.put(i, a[i]);
            treemaps.put(i, a[i]);
        }
    }

    public static void main(String[] a) {
        People[] people = new People[10];
        for (int i = 0; i < 10; i++) {
            People p = new People(""+i, "n"+i, true, i);
            people[i] = p;
        }
        StorageTest storage = new StorageTest(people);
        ArrayList<Comparable> members = storage.arrays;
        System.out.println("member list:\n>>>");
        for (Comparable x: members) {
            People person = (People)x;
            System.out.println("id: " + person.id);
            System.out.println("name: " + person.name);
            System.out.println("age: " + person.age);
            System.out.println();
        }
    }
}
